hotfix: show task status dropdown to backlog task status#1391
hotfix: show task status dropdown to backlog task status#1391iamitprakash merged 2 commits intodevelopfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis change simplifies the TaskStatusDropdown component by removing conditional rendering logic for backlog status. The component now unconditionally delegates status display and selection to the TaskStatusSelect component, eliminating a branching condition. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/components/tasks/TaskStatusDropdown.tsx`:
- Around line 163-167: The select's value can be initialized to BACKLOG while
BACKLOG is removed from options by EXCLUDED_STATUSES, causing an unmatched
value; in TaskStatusDropdown/TaskStatusSelect adjust the options or state
initialization so the select value always matches an available option: either
(A) when oldStatus === "BACKLOG" include "BACKLOG" in the options fed to
TaskStatusSelect (override EXCLUDED_STATUSES for this case), or (B) initialize
newStatus to a valid option (e.g., the first entry from the filtered options)
instead of oldStatus; update the logic around newStatus, oldStatus,
EXCLUDED_STATUSES, TaskStatusSelect and handleChange accordingly so the rendered
<select> value and options are consistent.
| expect(msgTag).toBeNull(); | ||
| }); | ||
| it('should show text Backlog when a task with Backlog status is passed down.', () => { | ||
| it.skip('should show text Backlog when a task with Backlog status is passed down.', () => { |
There was a problem hiding this comment.
skipping the test since it's hotfix, will fix tests in another PR
There was a problem hiding this comment.
@coderabbitai can we please raise an PR for writing test for this feature
There was a problem hiding this comment.
🧩 Analysis chain
@AnujChhikara I'll create a GitHub issue to track this follow-up work (I cannot create PRs directly, but an issue will ensure the test work is tracked and can be addressed in a subsequent PR).
🏁 Script executed:
#!/bin/bash
# Create a GitHub issue for writing tests for the backlog feature
gh issue create \
--title "Write test for Backlog task status dropdown feature" \
--body "## Context
A test was skipped in PR `#1391` as part of a hotfix to show task status dropdown for backlog task status.
**Skipped test:**
\`\`\`typescript
it.skip('should show text Backlog when a task with Backlog status is passed down.', () => {
const oldProgress = 100;
const oldStatus = BACKEND_TASK_STATUS.BACKLOG;
render(
<TaskStatusDropdown
oldProgress={oldProgress}
oldStatus={oldStatus}
onChange={onChange}
/>
);
const element = screen.getByTestId('task-status-backlog');
expect(element).toHaveTextContent('Backlog');
});
\`\`\`
**File:** \`__tests__/Unit/Components/Tasks/TaskStatusDropdown.test.tsx\`
## Task
- [ ] Unskip and fix the test for backlog status display
- [ ] Ensure the test properly validates the backlog status behavior in TaskStatusDropdown component
- [ ] Verify all related test cases are passing
## References
- PR: `#1391`
- Comment: https://github.com/RealDevSquad/website-status/pull/1391#discussion_r2714057902
- Requested by: `@AnujChhikara`" \
--assignee AnujChhikara
Length of output: 58
@AnujChhikara I've created issue #1396 to track the test work for the backlog feature: #1396
The issue includes:
- Context from this hotfix PR
- The skipped test code that needs to be fixed
- A checklist of tasks to complete
- Assignment to you for tracking
This ensures the follow-up work won't be forgotten and can be addressed in a subsequent PR.
🧬 Code Graph Analysis Results
[File: src/constants/constants.ts, Lines: 55-58]
export const MSG_ON_100_PROGRESS =
'Proceeding further will make task progress 100%.';
[File: src/constants/constants.ts, Lines: 57-58]
export const MSG_ON_0_PROGRESS =
'Proceeding further will make task progress 0%.';
[File: src/constants/task-status.ts, Lines: 39-56]
export const BACKEND_TASK_STATUS = {
UN_ASSIGNED,
ASSIGNED,
IN_PROGRESS,
BACKLOG,
BLOCKED,
COMPLETED,
NEEDS_REVIEW,
IN_REVIEW,
APPROVED,
SMOKE_TESTING,
SANITY_CHECK,
REGRESSION_CHECK,
MERGED,
RELEASED,
VERIFIED,
DONE,
};
[File: src/components/tasks/TaskStatusDropdown.tsx, Lines: 62-176]
export function TaskStatusDropdown({
isDevMode,
onChange,
oldStatus,
oldProgress,
}: Props) {
const [{ newStatus, newProgress }, setStatusAndProgress] = useState({
newStatus: oldStatus,
newProgress: oldProgress,
});
const [message, setMessage] = useState('');
const getAvailableTaskStatuses = () => {
return Object.entries(BACKEND_TASK_STATUS).filter(
([_, value]) => !EXCLUDED_STATUSES.includes(value)
);
};
const taskStatus = getAvailableTaskStatuses();
const isCurrentTaskStatusBlock = oldStatus === BACKEND_TASK_STATUS.BLOCKED;
const isCurrentTaskStatusInProgress =
oldStatus === BACKEND_TASK_STATUS.IN_PROGRESS;
const shouldTaskProgressBe100 = (newStatus: string) => {
const isNewStatusInProgress =
newStatus === BACKEND_TASK_STATUS.IN_PROGRESS;
const isNewTaskStatusBlock = newStatus === BACKEND_TASK_STATUS.BLOCKED;
const isCurrProgress100 = oldProgress === 100;
return (
(isCurrentTaskStatusBlock || isCurrentTaskStatusInProgress) &&
!isNewStatusInProgress &&
!isNewTaskStatusBlock &&
!isCurrProgress100
);
};
const shouldTaskProgressBe0 = (newStatus: string) => {
const isNewStatusInProgress =
newStatus === BACKEND_TASK_STATUS.IN_PROGRESS;
const isCurrProgress0 = oldProgress === 0;
return (
isNewStatusInProgress &&
!isCurrentTaskStatusBlock &&
!isCurrProgress0
);
};
const resetProgressAndStatus = () => {
setStatusAndProgress({
newStatus: oldStatus,
newProgress: oldProgress,
});
setMessage('');
};
const handleChange = (ev: React.ChangeEvent<HTMLSelectElement>) => {
const newStatusValue = ev.target.value;
setStatusAndProgress((prev) => ({
...prev,
newStatus: newStatusValue,
}));
if (oldStatus === newStatusValue) {
return;
}
if (isDevMode && newStatusValue !== BACKEND_TASK_STATUS.BACKLOG) {
const msg = `The progress of current task is ${oldProgress}%. `;
if (shouldTaskProgressBe100(newStatusValue)) {
setStatusAndProgress((prev) => ({ ...prev, newProgress: 100 }));
setMessage(msg + MSG_ON_100_PROGRESS);
return;
}
if (shouldTaskProgressBe0(newStatusValue)) {
setStatusAndProgress((prev) => ({ ...prev, newProgress: 0 }));
setMessage(msg + MSG_ON_0_PROGRESS);
return;
}
}
onChange({ newStatus: newStatusValue });
};
const handleProceed = () => {
const payload: { newStatus: string; newProgress?: number } = {
newStatus,
};
if (newProgress != oldProgress) {
payload.newProgress = newProgress;
}
onChange(payload);
setMessage('');
};
return (
<>
<label
className={
isDevMode ? styles.cardPurposeAndStatusFont : undefined
}
data-testid={isDevMode ? 'task-status-label' : undefined}
>
Status:{' '}
<TaskStatusSelect
newStatus={newStatus}
handleChange={handleChange}
taskStatus={taskStatus}
/>
</label>
<TaskDropDownModel
message={message}
resetProgressAndStatus={resetProgressAndStatus}
handleProceed={handleProceed}
/>
</>
);
}
Date: 22-01-2026
Developer Name: @MayankBansal12
Issue Ticket Number
Description
Documentation Updated?
Under Feature Flag
Database Changes
Breaking Changes
Development Tested?
Screenshots
demo
Screencast.from.2026-01-22.01-02-22.mp4
Additional Notes
ASSIGNED, will fix that in another PR